﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Milkify.Diagnostics
{
    public static class MilkifyTraceSources
    {
        private static TraceSource mUISource;
        public static TraceSource UISource
        {
            get
            {
                if (mUISource == null)
                    mUISource = CreateTraceSource("Milkify.UI");
                return mUISource;
            }
        }

        private static TraceSource mRtmSource;
        public static TraceSource RtmSource
        {
            get
            {
                if (mRtmSource == null)
                    mRtmSource = CreateTraceSource("Milkify.Data");
                return mRtmSource;
            }
        }

        private static TraceSource CreateTraceSource(string sourceName)
        {
            TraceSource traceSource = new TraceSource(sourceName);
            if (traceSource.Switch.Level == SourceLevels.Off && Debugger.IsAttached)
                traceSource.Switch.Level = SourceLevels.All;
            return traceSource;
        }
    }
}
